<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body onload=alert("加载完成")>
		<input type="text" name="" id="in1" value="" />
		<p id="p1"></p>
		
		<form action="" method="" id="form">
			<input type="text" name="" id="in1" value="" />
			<input type="submit" name="" id="" value="提交" />
		</form>
		
		
		
	</body>
	<script type="text/javascript">
		var in1=document.getElementById("in1");//获取id
		var p1=document.getElementById("p1");//获取id
		var f=document.getElementById("form");//获取id
		in1.onblur=function(){
			alert(in1.value+"失去焦点");
		}
		in1.onfocus=function(){
			alert(in1.value+"获取焦点");
		}
		in1.onchange=function(){
			p1.innerHTML=in1.value;
			alert("元素内容改变");
		}
		
		in1.oninput=function(){
			p1.innerHTML=in1.value;
			alert("用户已输入");
		}
		
		f.onsubmit=function(){
			alert("表单已提交");
		}
		
		
		
		
	</script>
</html>
